package com.hnguigu.health.houduan.lq.service_lq.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hnguigu.health.houduan.lq.service_lq.TMemberService;
import com.hnguigu.health.mapper.*;
import com.hnguigu.health.pojo.TMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TMemberServiceImpl  implements TMemberService {
    @Autowired(required = false)
    TMemberMapper tMemberMapper;
    @Autowired(required = false)
    TInterposeClassifyMapper tInterposeClassifyMapper;
    @Autowired(required = false)
    TBodyTypeMapper tBodyTypeMapper;
    @Autowired(required = false)
    TMentalityResultMapper tMentalityResultMapper;
    @Autowired(required = false)
    TOrderMapper tOrderMapper;
    @Override
    public PageInfo<TMember> selectAllTmerber(int page, int num, String content) {
        PageHelper.startPage(page,num);
        return new PageInfo<>(tMemberMapper.selectAllTmerber(content));
    }

    @Override
    public PageInfo<TMember> selectAllinterveneTmerber(int page,int num,String content) {
        PageHelper.startPage(page,num);
        return new PageInfo<>(tMemberMapper.selectAllinterveneTmerber(content));
    }

    @Override
    public int updateAll(String tmerber) {
        int uptdstatus = tBodyTypeMapper.Uptdstatus(tmerber);
        int uptistatus = tInterposeClassifyMapper.Uptistatus(tmerber);
        int uptystatus = tMemberMapper.Uptystatus(tmerber);
        int uptmstatus = tMentalityResultMapper.Uptmstatus(tmerber);
        int uptostatus = tOrderMapper.uptostatus(tmerber);
        if(uptdstatus>0&&uptistatus>0&&uptystatus>0&&uptmstatus>0&&uptostatus>0){
            return 1;
        }
        return 0;
    }
}
